package com.KKd.service;

import com.KKd.mapper.BookMapper;
import com.KKd.pojo.Books;

import java.util.List;

/**
 * @author 14587
 * @date 2020/11/5 0:29
 */
public class BookServiceImpl implements BookService {
    //service层调用dao层(mapper层)
    //写一个set方法以便spring注入
    private BookMapper bookMapper;

    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    public int addBook(Books book) {
        return bookMapper.addBook(book);
    }

    public int deleteBookById(int id) {
        return bookMapper.deleteBookById(id);
    }

    public int updateBook(Books books) {
        return bookMapper.updateBook(books);
    }

    public Books queryBookById(int id) {
        return bookMapper.queryBookById(id);
    }

    public List<Books> queryAllBooks() {
        return bookMapper.queryAllBooks();
    }

    public Books queryBookByName(String bookName) {
        return bookMapper.queryBookByName(bookName);
    }
}
